<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"
                xmlns:sf="http://www.springframework.org/tags/faces"
                xmlns:sec="http://www.springframework.org/security/facelets/tags"
                xmlns:spring="http://www.springframework.org/tags"
				template="/WEB-INF/layouts/template.xhtml">

<ui:define name="main">
<script type="text/javascript">document.getElementById('menuClients').className="selected";</script>
<div id="main">
	<div id="wrapper" class="yui-b">
		<h3 class="title">${msg.title_client_review} ${client.name}</h3>
		<div id="mainContent">
			<h:form id="client" >
				<div class="yui-gd">
					<div class="yui-u first">
						<h3>${msg.client}</h3>
						<h:panelGroup rendered="${!(empty client.email)}">
							<div class="field">
								<div class="label">${msg.email}</div>
								<div class="output">${client.email}</div>
							</div>
						</h:panelGroup>
						<h:panelGroup rendered="${!(empty client.email)}">
							<div class="field">
								<div class="label">${msg.url}</div>
								<div class="output">${client.url}</div>
							</div>
						</h:panelGroup>
						<h:panelGroup rendered="${!(empty client.address.street and empty client.address.city)}">
							<div class="field">
								<div class="label">${msg.address}</div>
								<h:panelGroup rendered="${!(empty client.address.street)}">
									<div class="output">${client.address.street}, ${client.address.number}</div>
								</h:panelGroup>
								<h:panelGroup rendered="${!(empty client.address.city)}">
									<div class="output">${client.address.city} ${client.address.zipcode} ${client.address.country}</div>
								</h:panelGroup>
							</div>
						</h:panelGroup>
						<h:panelGroup rendered="${!(empty client.phone)}">
							<div class="field">
								<div class="label">${msg.phone}</div>
								<div class="output">${client.phone}</div>
							</div>
						</h:panelGroup>
						<h:panelGroup rendered="${!(empty client.fax)}">
							<div class="field">
								<div class="label">${msg.fax}</div>
								<div class="output">${client.fax}</div>
							</div>
						</h:panelGroup>
					</div>
					
					<div class="yui-u">
						<h3>${msg.contact}</h3>
						<div class="field">
							<div class="label">${client.contact.name}</div>
						</div>
						<h:panelGroup rendered="${!(empty client.contact.email)}">
							<div class="field">
								<div class="label">${msg.email}</div>
								<div class="output">${client.contact.email}</div>
							</div>
						</h:panelGroup>
						<h:panelGroup rendered="${!(empty client.contact.mobile)}">
							<div class="field">
								<div class="label">${msg.mobile}</div>
								<div class="output">${client.contact.mobile}</div>
							</div>
						</h:panelGroup>
						<h:panelGroup rendered="${!(empty client.contact.phone)}">
							<div class="field">
								<div class="label">${msg.phone}</div>
								<div class="output">${client.contact.phone}</div>
							</div>
						</h:panelGroup>
						<h:panelGroup rendered="${!(empty client.contact.fax)}">
							<div class="field">
								<div class="label">${msg.fax}</div>
								<div class="output">${client.contact.fax}</div>
							</div>
						</h:panelGroup>
					</div>
					<div style="clear: both; height: 5px;" />
					<div>
						<sec:ifAnyGranted roles="ROLE_ADMIN">
							<sf:commandLink id="edit" action="edit"><div class="button">${msg.edit}</div></sf:commandLink>
							<sf:commandLink id="delete" action="delete"><div class="button">${msg.delete}</div></sf:commandLink>
						</sec:ifAnyGranted>
					</div>
					<div style="clear: both; height: 5px;" />
					<sec:ifAnyGranted roles="ROLE_ADMIN">
						<div>
							<h4>${msg.assignedProjects}</h4>
							<h:dataTable id="projects" styleClass="summary" value="${projects}" var="p" rendered="${projects.rowCount > 0}" >
						    	<h:column>
						    		<f:facet name="header">${msg.name}</f:facet>
						    		<sf:commandLink id="viewProjectLink" action="selectProject">${p.name}</sf:commandLink>
						    	</h:column>
						    	<h:column>
						    		<f:facet name="header">${msg.description}</f:facet>
						    		${p.description}
						    	</h:column>
						    	<h:column>
						    		<f:facet name="header"></f:facet>
						    		<h:outputText rendered="${p.retired}">${msg.retired}</h:outputText>
						    	</h:column>
						    </h:dataTable>
					    </div>
				    </sec:ifAnyGranted>
				</div>
			</h:form>
		</div>
	</div>
</div>
<div style="clear: both; height: 5px;" />
<h:form><sf:commandLink id="back" action="back"><div class="button">${msg.back} ${msg.title_client}</div></sf:commandLink></h:form>
</ui:define>
</ui:composition>